<?
session_start();

require_once('config.php');
require_once('class/cls_customer.php');

$customer			= new cls_customer();

if (isset($_SESSION['id']))
        {
		$coordinator_id		= $_SESSION['id'];

				
		}
	
			
//if (isset($_REQUEST['rid']))
        //{
			// $user->delete_user($_REQUEST['rid']);

        //}

				
 	
?>
<html>
<head>
<title>Show Sales List</title>
<link href="um_sty.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
function open_calendar(obj)
{
	new_window=window.open("calendar.php?form=report&field=" + obj,"","top=50,left=400,width=575,height=140,menubar=no,toolbar=no,scrollbars=no,resizable=no,status=no");
}
</script>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#F7F9F0">



<table id="Table_01" width="775" border="0" cellpadding="0" cellspacing="0" align="center">

	<tr>

		<td><table id="Table_01" width="775" height="32" align="center" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="233" height="32"><img src="images/banner.jpg" width="774" height="100" alt=""></td>
            
          </tr>
        </table>
		  <!-- End ImageReady Slices -->
		  <table id="Table_02" width="775" height="24" align="center" bgcolor="#000000" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td width="544" align="left" valign="middle">&nbsp;&nbsp;&nbsp;<a  href="index.php" class="ummenu" >Home</a>		

		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		
		<a href="customer_service.php" class="ummenu">Customer Services</a>
		
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

		<a href="contact_us.php" class="ummenu">Contact Us</a>
		
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

		<a href="aboutus.php" class="ummenu">About Us</a>
              <td width="231" height="24" align="right" valign="middle"><a href="http://66.94.233.46/babelfish/trurl_pagecontent?lp=en_ja&trurl=http%3a%2f%2fwww.umgroups.com"> </a>&nbsp;&nbsp; <a href="http://66.94.233.46/babelfish/trurl_pagecontent?lp=en_zt&trurl=http%3a%2f%2fwww.umgroups.com"> </a>&nbsp;&nbsp; <a href="http://66.94.233.46/babelfish/trurl_pagecontent?lp=en_ko&trurl=http%3a%2f%2fwww.umgroups.com"> </a>&nbsp;&nbsp;&nbsp;&nbsp;</td>
            </tr>
          </table></td>

	</tr>
	
	<tr><td>
	<table id="Table_01" width="775" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#FFFFFF" style="border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC" >
	<tr>
	  <td colspan="8">&nbsp;</td>
	  </tr>
	<tr><td colspan="8">
	

<?

/*
	This function is for changing the date format into "2007-6-25"
	Because, the database only accepts the date format in "Year-Month-Day"
 */
function render_date($mydate)
{
	return	strftime("%Y-%m-%d",strtotime($mydate));
}


	
	

?>
	
	</td></tr>
      <tr>
        <td>
		<table width="775px" align="center">
          <tr>
            <td align="center">&nbsp;</td>
            <td align="center">&nbsp;</td>
            <td align="center">&nbsp;</td>
            <td>&nbsp;</td>
			 <td>&nbsp;</td>
			 <td>&nbsp;</td>
			 <td>&nbsp;</td>
			 <td>&nbsp;</td>
			 <td>&nbsp;</td>
          </tr>
          <tr>
            <td align="center"></td>
            <td align="center">First Name</td>
            <td align="center">Last Name</td>
            <td align="center">Email</td>
			<td align="center">Date</td>
			<td align="center">Brand</td>
			<td align="center">Type</td>
			<td align="center">Quantity</td>
			<td>&nbsp;</td>
          </tr>
          <tr>
            <td colspan="8"><hr width="100%"></td>
          </tr>
          <?
			
		if (isset($_POST['cmdSubmit'])) {	// checking whether it is post or not.

	$fromdate	= render_date($_POST['fromdate']);	// change the date format into "Year-Month-Day"
	$todate		= render_date($_POST['todate']); 	// change the date format into "Year-Month-Day"
	
	if ($fromdate > $todate) 
	{
		echo "<font color=red ><h5>&nbsp;&nbsp;Wrong Date</h5></font>";}
	else{
	$pageno	 	= isset($_REQUEST['page']) 	? $_REQUEST['page'] : 1;	

		$object		= $customer->get_coordinator_saleslist1($pagen,$fromdate,$todate,$coordinator_id);
		
	$pagecount	= $object['pagecount'];
		
		$numrows	= $object['numrows'];		
		
		unset($object['numrows'],$object['pagecount']);
			
		//echo "<pre>";
		//print_r ($object);
	//	echo "</pre>";
		
		if (count($object) > 0)
		{
			foreach ($object as $row) {
?>
          <tr>
            <td align="center"></td>
            <td align="center"><?= $row['firstname'] ?></td>
            <td align="center"><?= $row['lastname'] ?></td>
            <td align="center"><?= $row['email'] ?></td>
			<td align="center"><?= $row['date'] ?></td>
			<td align="center"><?= $row['brand'] ?></td>
			<td align="center"><?= $row['type'] ?></td>
			<td align="center"><?= $row['qty'] ?></td>
			<td>&nbsp;</td>
          </tr>
          <tr>
            <td colspan="8"><hr width="100%"></td>
          </tr>
                    <?			}//for
		}//if	
			}
?>
		           
            <tr>
            <td colspan="5">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<? 
				require_once("class/cls_utility.php");
				$utility	= new utility();
				//$utility->paging("",$pagecount,$numrows,$qrystr,$pageno); 
				$utility->paging("",$pagecount,$numrows,"",$pageno);}
			?></td>
			<td colspan="3" align="right"><a href="selection.php">Back to Selection Page.</a>&nbsp;&nbsp;&nbsp;</td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="2" bgcolor="#CCCCCC"></td>
      </tr>
      <tr>
        <td><table align="center" border="0" cellpadding="0" cellspacing="0" width="775" id="table6" bgcolor="#FFFFFF" style="border-bottom: 3px solid #DF8A0B;">

			<tr>

				<td width="100%" height="30" class="foot">&nbsp;</td>
			</tr>
		</table></td>
      </tr>
</table></td></tr>
</body>
</html>
